package org.ifilm.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.CollectionOfElements;

/**
 * 
 * User Model
 * @author Mustafa Genç
 *
 */
@Entity(name = "user")
public class User {
	@Id
	@GeneratedValue
	long id;
	
	private String nickname;
	
	private String name;
	
	private String surname;
	
	@Column(unique=true, nullable=false)
	private String email;
	
	@CollectionOfElements
	private List<String> userType = new ArrayList<String>();
	
	private String password;
	
	private String professionalInfo;
	
	private String about;
	
	private String gender;
	
	private String thumbnailUrl;
	
	@CollectionOfElements
	private List<String> photoPaths = new ArrayList<String>();
	
	private String birthdate;
	
	private String phone;
	
	private float averageRate = (float) 0.0;
	
	private long totalRate = 0;
	
	private Integer height;
	
	private Integer weight;
	
	private Integer age;
	
	private String hairColor;
	
	private String eyeColor;
	
	private Date creationTime;
	
	private Date updateTime;
	
	@OneToMany
	private List<User> followingUsers = new ArrayList<User>();
	
	@OneToMany(fetch = FetchType.EAGER)
	private List<Project> favoriteProjects = new ArrayList<Project>();

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@JsonIgnore
	public List<String> getUserType() {
		return userType;
	}

	public void setUserType(List<String> userType) {
		this.userType = userType;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getProfessionalInfo() {
		return professionalInfo;
	}

	public void setProfessionalInfo(String professionalInfo) {
		this.professionalInfo = professionalInfo;
	}

	public String getAbout() {
		return about;
	}

	public void setAbout(String about) {
		this.about = about;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getThumbnailUrl() {
		return thumbnailUrl;
	}

	public void setThumbnailUrl(String thumbnailUrl) {
		this.thumbnailUrl = thumbnailUrl;
	}

	public String getBirthdate() {
		return birthdate;
	}

	public void setBirthdate(String birthdate) {
		this.birthdate = birthdate;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public float getAverageRate() {
		return averageRate;
	}

	public void setAverageRate(float averageRate) {
		this.averageRate = averageRate;
	}

	public long getTotalRate() {
		return totalRate;
	}

	public void setTotalRate(long totalRate) {
		this.totalRate = totalRate;
	}

	public Date getCreationTime() {
		return creationTime;
	}

	public void setCreationTime(Date creationTime) {
		this.creationTime = creationTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@JsonIgnore
	public List<User> getFollowingUsers() {
		return followingUsers;
	}

	public void setFollowingUsers(List<User> followingUsers) {
		this.followingUsers = followingUsers;
	}
	
	public List<Project> getFavoriteProjects() {
		return favoriteProjects;
	}

	public void setFavoriteProjects(List<Project> favoriteProjects) {
		this.favoriteProjects = favoriteProjects;
	}
	
	@JsonIgnore
	public List<String> getPhotoPaths() {
		return photoPaths;
	}

	public void setPhotoPaths(List<String> photoPaths) {
		this.photoPaths = photoPaths;
	}
	
	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	public String getHairColor() {
		return hairColor;
	}

	public void setHairColor(String hairColor) {
		this.hairColor = hairColor;
	}

	public String getEyeColor() {
		return eyeColor;
	}

	public void setEyeColor(String eyeColor) {
		this.eyeColor = eyeColor;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}
}